package com.malty.mall.domain.dto.req.pms;

import com.malty.mall.domain.entity.pms.PmsProduct;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @author malty
 */
@Data
@NoArgsConstructor
@ApiModel("商品信息")
public class PmsProductParam {
    private Long id;
    private String name;
    private String subTittle;
    private String productSn;
    private Long categoryId;
    private Long brandId;
    private String description;
    private String stockThreshold;
    private Long skuStock;
    private String picCover;
    private String picAlbums;
    private String detailHtml;
    private String detailHtmlMobile;
    private String deleteStatus;
    private String verifyStatus;
    private Long sort;
    private Double price;

    public PmsProductParam(PmsProduct product) {
        if (product != null) {
            BeanUtils.copyProperties(product, this);
        }
    }

    public static List<PmsProductParam> productParams(List<PmsProduct> list) {
        List<PmsProductParam> productCateParams = new ArrayList<>();
        for (PmsProduct category : list) {
            productCateParams.add(new PmsProductParam(category));
        }
        return productCateParams;
    }
}
